import wx
import vtk
from vtk.wx.wxVTKRenderWindowInteractor import *
from jolly.visual.vtkPythonViewImage2D import *
from jolly.datamanagement.vtkPythonMetaImageData import *
class wxApp(wx.App):
   def OnInit(self):
       return True

class Frame(wx.Frame):
   def __init__(self):
       super(Frame, self).__init__(None, -1)
       self.init()

   def init(self):
       self.sizer =  wx.BoxSizer(wx.VERTICAL)
       self.viewxy = wxVTKRenderWindowInteractor(self, -1)
       self.view1 = vtkPythonViewImage2D()
       self.view1.SetInput(None)
       self.view1.GlobalWarningDisplayOff()
       self.view1.SetupInteractor(self.viewxy)
       self.view1.SetRenderWindow(self.viewxy.GetRenderWindow())
       self.view1.SetBackground(0.0, 0.0, 0.0)
       self.view1.SetSliceOrientationToXY()
       self.view1.SetSize([300, 300])
       self.view1.SetInteractorStyleTypeToNavigation()

       self.Image = vtkPythonMetaImageData()
       self.Image.ReadSeriesFile("C:/head")
       self.view1.SetInput(self.Image.getDataSet())
       

if __name__ == '__main__':
   wxApp = wxApp(0)
   frame = Frame()
   frame.Show()
   wxApp.SetTopWindow(frame)
   wxApp.MainLoop()
